package datastructure.sort;

/**
 * @author yinlei
 * @date 2018/7/2
 * @since 1.0.0
 */
public class BubbleSort implements SortMain.Sort {

    public void sort(int[] arr) {
        int size = arr.length;
        for (int i = 0; i < size; i++) {
            for (int j = 1; j < size - i; j++) {
                if (arr[j] < arr[j - 1]) {
                    SortUtil.swap(arr, j, j - 1);
                }
            }
        }
    }
}
